/*
 * @Description:
 * @Author: william
 * @Date: 2024-01-15 13:46:30
 * @LastEditors: william
 * @LastEditTime: 2025-03-18 10:06:57
 */
/**
 * 自动引入api目录下所有文件的内容暴露
 * @date 2024/1/10 - 17:06:51
 *
 * @returns {Object} API模块集合
 */
const getApiModules = () => {
  const modulesFiles = import.meta.glob('./**/*.js', { eager: true })

  return Object.entries(modulesFiles).reduce((modules, [key, value]) => {
    const moduleName = key.match(/.*\/(.+)\.js$/)?.[1]
    if (moduleName) modules[moduleName] = value
    return modules
  }, {})
}

export default getApiModules()
